package com.hduong.springcloud.controller;

import entities.CommonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by dudu on 2020/3/18.
 */
@RestController
@Slf4j
public class OrderController {

    private final static String PAYMENY_URL = "http://before-cloud-payment-service/";

//    @Value("${server.port}")
//    private String serverPort;

    final RestTemplate restTemplate;

    public OrderController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @GetMapping("/getPort")
    public CommonResult getPort() {
        return restTemplate.getForObject(PAYMENY_URL + "getPort", CommonResult.class, new Object[]{});
    }

}
